VirtualGamepad

Virtual Gamepad peripheral interface for RemoteControl devices.

Allows to receive navigation events when some predefined inputs on the device are triggered.

The mapping between physical inputs (buttons, axes, etc.) on the device and received navigation events is specific to the remote control in use: please refer to the remote control documentation for further information.

This peripheral is provided by all remote control devices, unless explicitly stated otherwise in the specific remote control documentation.

To start receiving navigation events, the virtual gamepad peripheral must be grabbed and a listener (that will receive all events) must be provided. When the virtual gamepad is grabbed, the remote control will stop forwarding events associated to its navigation inputs to the connected drone (if any) and instead forward those events to the application-provided listener.

To stop receiving events and having the device forward navigation input events back to the connected drone, the virtual gamepad must be released.

Most remote control devices also provide a more specialized gamepad interface (please refer to the remote control documentation for further information), which usually allows to listen to finer-grained remote control input events. However, when inputs are grabbed using such a specialized interface, the virtual gamepad cannot be used anymore. In case it is also currently grabbed, it will switch to a preempted state where navigation events won't be forwarded to the provided listener anymore, until all inputs on the specialized gamepad interface are released. At that point, the virtual gamepad will grab the navigation inputs again and resume forwarding events to the application listener.

The application can also subscribe to gamepad application events that are forwarded through a local broadcastintent when a combination of some physical inputs is triggered on the remote control. Those events are the APP_ACTION_* values defined in ButtonsMappableAction enum. How those events are mapped to physical inputs and how those mappings can be configured is specific to the remote control device in use, please refer to the remote control documentation for further information.

This peripheral can be obtained from a RemoteControl using:

remoteControl.getPeripheral(VirtualGamepad.class)

See also

Peripheral.Provider

Types

Link copied to clipboard
enum Event
A navigation event sent when the appropriate remote control input is triggered.
Link copied to clipboard
enum State
State of the virtual gamepad peripheral.

Properties

Link copied to clipboard
val ACTION_GAMEPAD_APP_EVENT: String = "com.parrot.drone.groundsdk.device.peripheral.ACTION_GAMEPAD_APP_EVENT"
Intent action sent in a local broadcast when a gamepad application event has been triggered from the remote control device.
Link copied to clipboard
val EXTRA_GAMEPAD_APP_EVENT_ACTION: String = "com.parrot.drone.groundsdk.device.peripheral.EXTRA_GAMEPAD_APP_EVENT_ACTION"
Intent extra sent along ACTION_GAMEPAD_APP_EVENT intent when a gamepad application event has been triggered.

Functions

Link copied to clipboard
abstract fun canGrab(): Boolean
Tells whether the virtual gamepad can be grabbed at the moment.
Link copied to clipboard
Gets the current virtual gamepad state.
Link copied to clipboard
Grabs the remote control navigation inputs.
Link copied to clipboard
abstract fun release()
Release the remote control navigation inputs.